﻿cmake_minimum_required(VERSION 3.14)

project(${XLSX_LIB_NAME})

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


file(GLOB PROJECT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB PROJECT_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)

# 库文件输出路径

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBPATH})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBPATH})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECPATH})

set(BUILD_SHARED_LIBS OFF) #静态库 当前不可用需要配置

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui)

add_library(${PROJECT_NAME} SHARED
${PROJECT_SOURCES}
${PROJECT_HEADERS}
)

#set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui)
#include(GNUInstallDirs)

include_directories(${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(${PROJECT_NAME} PRIVATE XLSX_LIBRARY)
